package org.bwgl.demo1.controller;

import org.springframework.web.bind.annotation.*;

@RestController
public class MyTest2 {
    @GetMapping(value = "test2")
//    增删改查 post  delete put get
//    @PostMapping
//    @PutMapping
//    @DeleteMapping tttt

//    如果mapping方法有参数，并且参数变量和网页传值的参数变量一样，默认就会帮你传值
    public String test2(String user){
        return "User2111："+user;
    }

//    使用了RequestParam后的参数默认为必需提供的
    @GetMapping(value = "test3")
    public String test3(@RequestParam(value = "username",required = false) String user){
        return user;
    }

//    都要写一个html form表单
    @PostMapping(value = "test4")
    public String test4(String username,String password){
        return username + password;
    }

//    反射 reflect
    @PostMapping(value= "test5")
    public String test5(@RequestBody UserOld user){
        return user.toString();
    }

}
